var b;
$(document).ready(function (){
                
                 /*$("#uploadForm").submit(function(){
                      jQuery.ajax({
                                   url:'system/fileupload.html',
                                   data:$("#uploadForm").serialize(),
                                   type:"POST", 
                                   dataType:"json",
                                  contentType:'multipart/form-data',
                                   processData:false,
                                   beforeSend:function(){
                                           $("#img").show();
                                           banner(1);
                                           $("#progressbar").show(); 
                                           b=setInterval(uploadbanner,150); 
                                    },
                                    success:function(data){
                                            $("#banner").html("success!");
                                            $("#img").hide();
                                            $("#progressbar").hide();
                                             alert(data.msg);
                                             clearInterval(b); 
                                    }
                     });
                     return false;
      });*/
  $("#subButton").click(function(){
           $("#uploadForm").attr({action:"customer/files/uploadfiles.html",method:"POST"}).submit();
           $("#img").show();
           banner(0.1);
           $("#progressbar").show();
           $("#banner").html(""); //清空操作   
           $("#success").hide();  
       b=setInterval(uploadbanner,300);
     }); 
               
});
function banner(bannervalue){
 $("#progressbar").progressbar({  
        value:bannervalue,   //  
    }); 
    
}
function uploadbanner(){
  
     jQuery.ajax({
        url:'system/uploadbanner.html',
        type:"POST", 
        dataType:"json",
         success:function(data){ 
              if(data.bannervalue==100){
                $("#banner").html("上传成功!");
                $("#success").slideDown("slow");
                $("#img").hide();
                $("#progressbar").hide();
                clearInterval(b);     
                }else{
                     banner(data.bannervalue);
                    $("#banner").html(data.parcent);             
                }
               
         }
    });      
  
}